import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// 导入全局样式
import './assets/css/global.css'
// 导入字体样式
import './assets/fonts/iconfont.css'
// 导入阿里图标库
import './assets/font_ali/iconfont.css'
// 导入共用方法
import comm from '../commonFun/common.js'
// 导入axios
import axios from 'axios'
// 配置请求根
axios.defaults.baseURL = 'http://localhost:3000'
// 拦截器请求
axios.interceptors.request.use(function (config) {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
// 拦截器响应
axios.interceptors.response.use(function (res) {
  var data = res.data
  // console.log(data.msgCode)
  if (data.msgCode === -1) {
    window.location.href = '/'
  }
  return data
})
Vue.prototype.$http = axios
Vue.prototype.comm = comm

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
